#ifndef TASK_H
#define TASK_H

#include <QThread>

#include <optra/common/logevent.h>

class Task : public QThread
{
Q_OBJECT
public:
    Task(const QString& name, QObject *parent = 0);

    inline bool canRemove() { return canRemove_; }
    inline bool mustFinish() { return mustfinish; };
    inline void mustFinish(bool yes) { mustfinish = yes; };
    inline void id(const QString& i) { id_ = i; }
    inline QString id() { return id_; }
signals:
    void state(const QString& message, Optra::LogEvent::LogType type);
public slots:

protected:
    virtual void run() = 0;
    void setCanRemove(bool b = true) { canRemove_ = b; }
private:
    QString id_;
    QString name_;
    bool canRemove_;
    bool mustfinish;
};

#endif // TASK_H
